#include <interface\ressource.h>

#include <cstdio>

ressource::ressource(): validity( DFT_RES_VAL ),
                        baseVal( DFT_RES_VAL ),
                        RSname( "<NONE>" )
{}
ressource::ressource(int val):  validity( val ),
                                baseVal( val ),
                                RSname( "<NONE>" )
{}
ressource::~ressource(){
        printf("Ressource deleted: %s\n",RSname.c_str());
}

int     ressource::getType(){
    return type;
}

void    ressource::setValidity(int val){
        baseVal = val;
        validity = val;
}

bool    ressource::update(){
        if( baseVal == RES_ESSENTIAL ) return true;
        validity--;
        if( !validity ) return false;
        return true;
}
string ressource::getRSname(){
    return RSname;
}

void    ressource::reset(){
        validity = baseVal;
}
